package main

import "fmt"

func main() {
	a, b := 10, 20

	// 通过一个函数叫唤a,b的值

	// 变量本身叫唤， 值传递（站在变量角度）
	swap_04_1(a, b)
	fmt.Printf("main: a = %d, b = %d \n", a, b)

	swap_04_2(&a, &b)
	fmt.Printf("main *: a = %d, b = %d \n", a, b)

}

func swap_04_1(a, b int) {
	a, b = b, a
	fmt.Printf("swap_04_1: a = %d, b = %d \n", a, b)
}

func swap_04_2(p1, p2 *int) {
	*p1, *p2 = *p2, *p1
	fmt.Printf("swap_04_2: a = %d, b = %d \n", *p1, *p2)
}
